<?php
// Options
$contentOptions = array(
	0 => array(
		"text" => "Añadir",
		"link" => Utils::generateSEOUrl($lang, $section, "add"),
		"icon" => IMAGES_URL."icons/small/white/Home.png"
	),
);
$content->assign("contentOptions", $contentOptions);

// Content
$data = $db->getData("blogEntries");
if (is_array($data) && count($data)) {
	for ($i=0; $i<count($data); $i++) {
		$entryId = $data[$i]["id"];
		$data[$i]["editUrl"] = Utils::generateSEOUrl($lang, $section, "edit", $entryId);
		$data[$i]["reviseCommentsUrl"] = Utils::generateSEOUrl($lang, "blogcomments", "list", $entryId);
		// Total comments
		$query = "SELECT count(*) AS totalComments FROM blogComments WHERE entryId = '$entryId'";
		$res11 = $db->runQuery($query);
		$row11 = $db->getRow($res11);
		$data[$i]["totalComments"] = $row11["totalComments"];
		// Blocked comments
		$query = "SELECT count(*) AS blockedComments FROM blogComments WHERE entryId = '$entryId' AND status = 2";
		$res12 = $db->runQuery($query);
		$row12 = $db->getRow($res12);
		$data[$i]["blockedComments"] = $row12["blockedComments"];
		// New comments
		$query = "SELECT count(*) AS newComments FROM blogComments WHERE entryId = '$entryId' AND status = 0";
		$res13 = $db->runQuery($query);
		$row13 = $db->getRow($res13);
		$data[$i]["newComments"] = $row13["newComments"];
	}
}
$content->assign("data", $data);
?>
